<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $direction; ?>" lang="<?php echo $lang; ?>" xml:lang="<?php echo $lang; ?>">
<head>
<title><?php echo $title; ?></title>
<?php if ($description) { ?>
<meta name="description" content="<?php echo $description; ?>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php } ?>
<base href="<?php echo $base; ?>" />
<?php if ($icon) { ?>
<link href="<?php echo $icon; ?>" rel="icon" />
<?php } ?>
<?php foreach ($links as $link) { ?>
<link href="<?php echo str_replace('&', '&amp;', $link['href']); ?>" rel="<?php echo $link['rel']; ?>" />
<?php } ?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/stylesheet.css" />
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/stylesheet2.css" />
<!--
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/me/v1.css" />
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/me/top_content.css" />
 -->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/ie6.css" />
<script type="text/javascript" src="catalog/view/javascript/DD_belatedPNG_0.0.8a-min.js"></script>
<script>
DD_belatedPNG.fix('img, #header .div3 a, #content .left, #content .right, .box .top');
</script>
<![endif]-->
<?php foreach ($styles as $style) { ?>
<link rel="<?php echo $style['rel']; ?>" type="text/css" href="<?php echo $style['href']; ?>" media="<?php echo $style['media']; ?>" />
<?php } ?>
<script type="text/javascript" src="catalog/view/javascript/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="catalog/view/javascript/jquery/thickbox/thickbox-compressed.js"></script>
<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/thickbox/thickbox.css" />
<script type="text/javascript" src="catalog/view/javascript/jquery/tab.js"></script>
<?php foreach ($scripts as $script) { ?>
<script type="text/javascript" src="<?php echo $script; ?>"></script>
<?php } ?>
<script type="text/javascript"><!--
function bookmark(url, title) {
	if (window.sidebar) { // firefox
    window.sidebar.addPanel(title, url, "");
	} else if(window.opera && window.print) { // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} else if(document.all) {// ie
   		window.external.AddFavorite(url, title);
	}
}

function uploadProduct()
{
	window.location = "http://localhost/99xu/index.php?route=upload/upload";
}


//--></script>

<!----------Tan Phat---------------------------------- -->
<!---------------Add code google Anaylysics----------- -->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-33480474-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

<!-------------End Tan Phat--------------------------->

<!-----Code google analytics --->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-33931185-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
<!--- end Aug 8 2012--->

</head>
<body>
<div id="container1">
<div id="top_header_new">  
  <div class="div1" style=""> 
  	<div onclick="uploadProduct();" style="background:url('http://localhost/99xu/image/logo/click.gif') repeat-x; float: left;width: 320px; height: 90px;">  		
  	</div>
  	<div style="float:left; height: 90px; width: 600px;display: block;">
	  	<div class="div3">
		     <img src="http://localhost/99xu/image/logo/new.gif" alt="" />
		     <a href="http://localhost/99xu/forum">Diễn đàn</a>		     
		    <?php if (!$logged) { ?>
			  	<a href="<?php echo $login; ?>" title="Đăng nhập"><?php echo $text_login; ?></a>
			<?php } else { ?>
				 <!-- <a href="javascript:void(0);">	<?php echo $text_hello;?>  </a> -->
				 <a href="<?php echo $account; ?>">Chào <?php echo $user_id; ?></a>
			<?php } ?>
		    <?php if (mb_strlen($shopname) > 0 ) { ?>
				<a href="<?php echo $linkshop; ?>" title="Gian hàng của tôi" ><?php echo $text_shop; ?></a>
			<?php } ?>
			<?php if (isset($register)) { ?>
				<a href="<?php echo $register; ?>" title="Đăng ký" ><?php echo $text_register; ?></a>
			<?php } ?>
		  	<a href="<?php echo $introduce; ?>" title="Giới thiệu" >Giới thiệu</a>
		  	<a href="<?php echo str_replace('&', '&amp;', $contact); ?>" title="Liên lạc" ><?php echo $text_contact; ?></a>
		  	<?php if ($logged) { ?>
				 <a href="<?php echo $logout; ?>" title="Thoát" ><?php echo $text_logout; ?></a>
			<?php } ?>
			<a onclick="bookmark(document.location, '<?php echo addslashes($title); ?>');" title="Lưu trang" ><?php echo $text_bookmark; ?></a>
	    </div>	    
	    <div class="div4" style="padding-top: 30px;">
	      <a href="<?php echo str_replace('&', '&amp;', $home); ?>" id="tab_home"><?php echo $text_home; ?></a>
	      <?php if (!$logged) { ?>
	      <a href="<?php echo str_replace('&', '&amp;', $login); ?>" id="tab_login"><?php echo $text_login; ?></a>
	      <?php } else { ?>
	      <a href="<?php echo str_replace('&', '&amp;', $logout); ?>" id="tab_logout"><?php echo $text_logout; ?></a>
	      <?php } ?>
	      <a href="<?php echo str_replace('&', '&amp;', $account); ?>" id="tab_account"><?php echo $text_account; ?></a>
	      <a href="<?php echo str_replace('&', '&amp;', $cart); ?>" id="tab_cart"><?php echo $text_cart; ?></a>
	      <a href="<?php echo str_replace('&', '&amp;', $uploadtosell); ?>" id="tab_checkout"><?php echo $text_uploadtosell; ?></a>
	    </div>		
  	</div>	
    <div class="div5">
      <div class="left"></div>
      <div class="right"></div>
      <div class="center">
        <div id="search">
          <div class="div8"><?php echo $entry_search; ?>&nbsp;</div>
          <div class="div9">
            <?php if ($keyword) { ?>
            <input type="text" onFocus="this.value=''" value="<?php echo $keyword; ?>" id="filter_keyword" />
            <?php } else { ?>
            <input type="text" value="<?php echo $text_keyword; ?>" id="filter_keyword" onclick="this.value = '';" onkeydown="this.style.color = '#000000'" style="color: #999;" />
            <?php } ?>
            <select id="filter_category_id">
              <option value="0"><?php echo $text_category; ?></option>
              <?php foreach ($categories as $category) { ?>
              <?php if ($category['category_id'] == $category_id) { ?>
              <option value="<?php echo $category['category_id']; ?>" selected="selected"><?php echo $category['name']; ?></option>
              <?php } else { ?>
              <option value="<?php echo $category['category_id']; ?>"><?php echo $category['name']; ?></option>
              <?php } ?>
              <?php } ?>
            </select>
          </div>
          <!-- 
          <div class="div10">&nbsp;&nbsp;<a onclick="moduleSearch();" class="button"><span><?php echo $button_go; ?></span></a> <a href="<?php echo str_replace('&', '&amp;', $advanced); ?>"><?php echo $text_advanced; ?></a>
          </div>
           -->
          <div>
	      	<!-- Sử dụng mã này có nghĩa là bạn đồng ý với Điều khoản Dịch vụ của Tìm kiếm Tuỳ chỉnh của Google. -->
			<!-- Điều khoản dịch vụ có sẵn tại http://www.google.com.vn/cse/docs/tos.html
			<form name="cse" id="searchbox_demo" action="http://www.google.com/cse">
			  &nbsp;<input type="hidden" name="cref" value="" />
			  <input type="hidden" name="ie" value="utf-8" />
			  <input type="hidden" name="hl" value="" />
			  <input name="q" type="text" size="40" />
			  <input type="submit" class="button" name="sa" value="Tìm kiếm" />
			</form>
			<script type="text/javascript" src="http://www.google.com.vn/cse/tools/onthefly?form=searchbox_demo&lang="></script>
			-->
		</div>
        </div>
      </div>
    </div>
  </div>
  <div class="div6">
    <div class="left"></div>
    <div class="right"></div>
    <div class="center">
      <div id="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
        <?php } ?>
      </div>
    </div>
  </div>
</div>
</div>
<script type="text/javascript"><!--
function getURLVar(urlVarName) {
	var urlHalves = String(document.location).toLowerCase().split('?');
	var urlVarValue = '';

	if (urlHalves[1]) {
		var urlVars = urlHalves[1].split('&');

		for (var i = 0; i <= (urlVars.length); i++) {
			if (urlVars[i]) {
				var urlVarPair = urlVars[i].split('=');

				if (urlVarPair[0] && urlVarPair[0] == urlVarName.toLowerCase()) {
					urlVarValue = urlVarPair[1];
				}
			}
		}
	}

	return urlVarValue;
}

$(document).ready(function() {
	route = getURLVar('route');

	if (!route) {
		$('#tab_home').addClass('selected');
	} else {
		part = route.split('/');

		if (route == 'common/home') {
			$('#tab_home').addClass('selected');
		} else if (route == 'account/login') {
			$('#tab_login').addClass('selected');
		} else if (part[0] == 'account') {
			$('#tab_account').addClass('selected');
		} else if (route == 'checkout/cart') {
			$('#tab_cart').addClass('selected');
		} else if (part[0] == 'checkout') {
			$('#tab_checkout').addClass('selected');
		} else {
			$('#tab_home').addClass('selected');
		}
	}
});
//--></script>
<script type="text/javascript"><!--
$('#search input').keydown(function(e) {
	if (e.keyCode == 13) {
		moduleSearch();
	}
});

function moduleSearch() {
	url = 'index.php?route=product/search';

	var filter_keyword = $('#filter_keyword').attr('value')

	if (filter_keyword) {
		url += '&keyword=' + encodeURIComponent(filter_keyword);
	}

	var filter_category_id = $('#filter_category_id').attr('value');

	if (filter_category_id) {
		url += '&category_id=' + filter_category_id;
	}

	location = url;
}
//--></script>
<script type="text/javascript"><!--
$('.switcher').bind('click', function() {
	$(this).find('.option').slideToggle('fast');
});
$('.switcher').bind('mouseleave', function() {
	$(this).find('.option').slideUp('fast');
});
//--></script>
